# $Id$
# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgbase=python-lazy-object-proxy
pkgname=(python-lazy-object-proxy python2-lazy-object-proxy)
pkgver=1.3.1
pkgrel=1
pkgdesc='A fast and thorough lazy object proxy'
arch=('i686' 'x86_64')
url="https://github.com/ionelmc/python-lazy-object-proxy"
license=('BSD')
makedepends=('python-setuptools' 'python2-setuptools')
checkdepends=('python-pytest-capturelog' 'python2-pytest-capturelog'
              'python-pytest-benchmark' 'python2-pytest-benchmark')
source=("$pkgbase-$pkgver.tar.gz::https://github.com/ionelmc/python-lazy-object-proxy/archive/v$pkgver.tar.gz")
sha256sums=('b315bc589ac934feb81c954424b501bf56afdbf7851918be4261c2ccdbb14ea7')

prepare() {
  cp -a python-lazy-object-proxy-$pkgver{,-py2}
}

build() {
  cd "$srcdir"/python-lazy-object-proxy-$pkgver
  python setup.py build

  cd "$srcdir"/python-lazy-object-proxy-$pkgver-py2
  python2 setup.py build
}

check() {
  cd "$srcdir"/python-lazy-object-proxy-$pkgver
  LC_CTYPE=en_US.UTF-8 PYTHONPATH="$PWD/build/lib.linux-$CARCH-3.6:$PYTHONPATH" py.test --ignore=src

  cd "$srcdir"/python-lazy-object-proxy-$pkgver-py2
  PYTHONPATH="$PWD/build/lib.linux-$CARCH-2.7:$PYTHONPATH" py.test2 --ignore=src
}

package_python-lazy-object-proxy() {
  depends=("python")

  cd python-lazy-object-proxy-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1
  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

package_python2-lazy-object-proxy() {
  depends=("python2")

  cd python-lazy-object-proxy-$pkgver-py2
  python2 setup.py install --root="$pkgdir" --optimize=1
  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
